<?php

namespace App\Models\Home\Blog;
use Illuminate\Database\Eloquent\Model;

class Posts extends Model
{
   protected $table = 'blog_posts';

   public  function getArticleList($field='',$limit=10){
       $field = $field?$field:'blog_posts.id';
       $where['blog_posts.status']=1;
       $re = $this->
            leftjoin('blog_category','blog_posts.category_id','=','blog_category.id')
            ->select('blog_posts.id','blog_posts.title','blog_category.title as category','blog_posts.created_at')->where($where)
            ->orderBy($field,'desc')
            ->paginate($limit);
       return $re ;
   }

}
